<!DOCTYPE html>
<!-- saved from url=(0052)http://getbootstrap.com/docs/4.0/examples/dashboard/ -->
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- Bootstrap core CSS -->
    <link th:href="@{../asserts/css/bootstrap.min.css}" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link th:href="@{../asserts/css/dashboard.css}" rel="stylesheet">
    <style type="text/css">
        @-webkit-keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }

        @keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }

        .chartjs-render-monitor {
            -webkit-animation: chartjs-render-animation 0.001s;
            animation: chartjs-render-animation 0.001s;
        }

        .hidden {
            display: none !important;
        }
    </style>
</head>

<body>
<div th:replace="commons/bar::topbar"></div>
<div class="container-fluid">
    <div class="row">
        <!--引入侧边栏-->
        <div th:replace="commons/bar::sidebar(activeUri='goodsInfos')"></div>
        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
            <th:block th:if="${goodsInfo ne null}">
                <h2>Изменить</h2>
            </th:block>
            <th:block th:if="${goodsInfo eq null}">
                <h2>Добавить</h2>
            </th:block>
            <form th:action="@{/goodsInfo}" method="post">
                <input type="hidden" name="_method" value="put" th:if="${goodsInfo ne null}">
                <div class="form-group">
                    <label for="goodsBarCode">Товарный штрих-код</label>
                    <input type="text" class="form-control" id="goodsBarCode" name="goodsBarCode" th:value="${goodsInfo ne null}?${goodsInfo.goodsBarCode}">
                </div>
                <div class="form-group">
                    <label for="goodsCategoryNumber">Номер категории товаров</label>
                    <select id="goodsCategoryNumber" class="form-control" name="goodsCategoryNumber">
                        <option>Выбирать...</option>
                        <option th:each="goodsCategory : ${goodsCategories}" th:text="${goodsCategory.categoryName}" th:value="${goodsCategory.categoryNumber}" th:selected="${goodsInfo ne null}?${goodsInfo.goodsCategoryNumber eq goodsCategory.categoryNumber}"></option>
                    </select>
                </div>
                <div class="form-group">
                    <label for="goodsName">Наименование товара</label>
                    <input type="text" class="form-control" id="goodsName" name="goodsName" th:value="${goodsInfo ne null}?${goodsInfo.goodsName}" required>
                </div>
                <div class="form-group">
                    <label for="goodsPurchasePrice">Цена покупки товара</label>
                    <input type="text" class="form-control" id="goodsPurchasePrice" name="goodsPurchasePrice" th:value="${goodsInfo ne null}?${goodsInfo.goodsPurchasePrice}" required>
                </div>
                <div class="form-group">
                    <label for="goodsOrigin">Происхождение товара</label>
                    <input type="text" class="form-control" id="goodsOrigin" name="goodsOrigin" th:value="${goodsInfo ne null}?${goodsInfo.goodsOrigin}" required>
                </div>
                <div class="form-group">
                    <label for="datetimepicker">Дата изготовления товара</label>
                    <div class="input-append date" id="datetimepicker" data-date="" data-date-format="dd/mm/yyyy">
                        <input id="goodsProductionDate" class="form-control" type="text" th:value="${goodsInfo ne null}?${#dates.format(goodsInfo.goodsProductionDate,'dd/MM/yyyy')}" name="goodsProductionDate" required>
                        <span class="add-on"><i class="icon-th"></i></span>
                    </div>
                </div>
                <div class="form-group">
                    <label for="goodsExpiryDate">Срок годности товара</label>
                    <input type="text" class="form-control" id="goodsExpiryDate" name="goodsExpiryDate" th:value="${goodsInfo ne null}?${goodsInfo.goodsExpiryDate}" required>
                </div>

                <div class="form-group">
                    <label for="goodsRawMaterial">Хорошее сырье</label>
                    <input type="text" class="form-control" id="goodsRawMaterial" name="goodsRawMaterial" th:value="${goodsInfo ne null}?${goodsInfo.goodsRawMaterial}" required>
                </div>
                <div class="form-group">
                    <label for="goodsSpecification">Хорошая спецификация</label>
                    <input type="text" class="form-control" id="goodsSpecification" name="goodsSpecification" th:value="${goodsInfo ne null}?${goodsInfo.goodsSpecification}" required>
                </div>
                <div class="form-group">
                    <label for="goodsManufacturer">Производитель товара</label>
                    <input type="text" class="form-control" id="goodsManufacturer" name="goodsManufacturer" th:value="${goodsInfo ne null}?${goodsInfo.goodsManufacturer}" required>
                </div>
                <div class="form-group">
                    <input type="submit" class="btn btn-primary" value="Разместить">
                </div>
            </form>
        </main>
    </div>
</div>

<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="../../asserts/js/jquery-3.2.1.slim.min.js"></script>
<script type="text/javascript" src="../asserts/js/popper.min.js"></script>
<script type="text/javascript" src="../asserts/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../asserts/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="../asserts/js/locales/bootstrap-datetimepicker.ru.js"></script>

<!-- Icons -->
<script type="text/javascript" src="../asserts/js/feather.min.js"></script>
<script>
    feather.replace()
</script>
<!-- Graphs -->
<script type="text/javascript" src="../asserts/js/Chart.min.js"></script>
<script>
    var ctx = document.getElementById("myChart");
    var myChart = new Chart(ctx, {
        type: 'line',
        data: {
            labels: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
            datasets: [{
                data: [15339, 21345, 18483, 24003, 23489, 24092, 12034],
                lineTension: 0,
                backgroundColor: 'transparent',
                borderColor: '#007bff',
                borderWidth: 4,
                pointBackgroundColor: '#007bff'
            }]
        },
        options: {
            scales: {
                yAxes: [{
                    ticks: {
                        beginAtZero: false
                    }
                }]
            },
            legend: {
                display: false,
            }
        }
    });
</script>
<script>
    $('#datetimepicker').datetimepicker({
        language:'ru',
        minView: 'month',
        autoclose: true,
        setStartDate: new Date(),
        todayBtn: true,
        todayHighlight: true,
        keyboardNavigation: true
    }).on('changeDate', function (ev) {
        $(this).datetimepicker('hide');
    });

    $('#datetimepicker2').datetimepicker({
        language:'ru',
        minView: 'month',
        autoclose: true,
        setStartDate: new Date(),
        todayBtn: true,
        todayHighlight: true,
        keyboardNavigation: true
    }).on('changeDate', function (ev) {
        $(this).datetimepicker('hide');
    });
</script>

</body>

</html>